Menuitem
A single choice in a menupopup element. It acts much like a button but it is rendered on a menu.
More information about Menuitem
Attributes:
Attributes inherited from XUL Element
This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the menuitem. This letter will typically be drawn underlined, although this behavior will be platform and skin specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the menuitem will be activated from anywhere in the window.
Indicates whether the menuitem is checked or not.
Set to an id of a command element that is being observed by the menuitem. If the command element's disabled attribute is set to true, the menuitem will become disabled. If the command disabled attribue is removed, the menuitem will be enabled. Similarly, the command's label attribute can be used to set the menuitem's label.
If the label of the menuitem is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text. If the box direction is right to left (rtl), the cropping is reversed.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
If this attribute is set to true, the menuitem is disabled. This is usually drawn with the text in grey. If the menuitem is disabled, the function of the button cannot be performed. Leave the attribute out entirely for a regular enabled button.
The URL of the image to appear on the menuitem. If this is attribute is left out, no image appears. The position of the image is determined by the dir and orient attributes.
The id of a key element that is used as the menu command's shortcut key. If used, text will be displayed beside the menu label to indicate which keys can be pressed to invoke the command.
The label that will appear on the menuitem. If this is left out, no text appears.
A list of modifier keys that should be pressed to invoke the handler. Multiple keys may be separated by spaces or commas. Keys will map to other keys on platforms that do not have them.
- shift: The Shift key.
- alt: The Alt key. On the Macintosh, this is the Option key.
- meta: The Meta key. On the Macintosh, this is the Command key.
- control: The Control key.
- accel: The key used for keyboard shortcuts on the user's platform. Usually, this would be the value you would use.
Radio menuitems with the same name as put into a group. Only one menuitem from each radio group can be checked at a time.
Indicates that the menuitem is selected in a menulist. You can use this to set the default value.
Can be used to create checkable menuitems or for radio button menuitems.
- checkbox: The menuitem is checked. The checked attribute determines whether the menuitem is checked or not.
- radio: The menuitem becomes part of a radio group. Other menuitems that have the same value for their name attributes are part of the same radio group. Only one menuitem in the same radio group can be checked at once.
This attribute indicates whether to load the image from the cache or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted:
- always: The image is always checked to see whether it should be reloaded.
- never: The image will be loaded from the cache if possible.
You can associate a data value with each menu and menuitem. It is used for nothing but you can access it with a script for your own purposes.
Properties and Methods:
Properties and Methods inherited from XUL Element
This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the menuitem. This letter will typically be drawn underlined, although this behavior will be platform and skin specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the menuitem will be activated from anywhere in the window.
Set to an id of a command element that is being observed by the menuitem. If the command element's disabled attribute is set to true, the menuitem will become disabled. If the command disabled attribue is removed, the menuitem will be enabled. Similarly, the command's label attribute can be used to set the menuitem's label.
If the label of the menuitem is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text. If the box direction is right to left (rtl), the cropping is reversed.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
If this attribute is set to true, the menuitem is disabled. This is usually drawn with the text in grey. If the menuitem is disabled, the function of the button cannot be performed. Leave the attribute out entirely for a regular enabled button.
Executes the associated command.
The URL of the image to appear on the menuitem. If this is attribute is left out, no image appears. The position of the image is determined by the dir and orient attributes.
The label that will appear on the menuitem. If this is left out, no text appears.
You can associate a data value with each menu and menuitem. It is used for nothing but you can access it with a script for your own purposes.